package com.learn.service.impl;

import com.learn.dao.AccountDao;
import com.learn.pojo.Account;
import com.learn.service.AccountService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author DJJ_F
 * @version 1.0
 * @date 2025/01/20
 * @description impl2 传播行为的示例
 */
@Service("accountService2")
public class AccountServiceImpl2 implements AccountService {
    @Resource
    private AccountDao accountDao;
    @Override
    public void transfer(int fromId, int toId, double money) {

    }

    @Transactional(propagation = Propagation.REQUIRES_NEW)
    @Override
    public void insert(Account account) {
        accountDao.insert(account);
//        String s = null;
//        s.toString();
    }
}
